<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<jsp:directive.page import="com.anhry.app.safety.util.Util"/>
<%@ include file="/WEB-INF/pages/share/taglib.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>发送提醒</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">	
	<link href="<%=basePath+Util.SKIN%>/css/right.css" type="text/css" rel="stylesheet">
	<script type="text/javascript" src="<%=basePath%>/js/jquery-1.7.2.js"></script>
	<script type="text/javascript" src="<%=basePath%>/js/check_jquery.js"></script>
	<script src="<%=basePath%>/js/oa.js" type="text/javascript"></script>
	<script type="text/javascript" src="<%=path%>/js/My97DatePicker/WdatePicker.js" defer="defer"></script><base target="_self" />
   	<script type="text/javascript" src="<%=basePath%>/js/dbdialog/lhgdialog.min.js<%=Util.LHGDIALOG%>"></script>
	
	<style>
		li{float:left;list-style:none;height:25px;padding-top:3px;}
		.rname{float:left;width:99%;height:70px;border:1px #aaa solid;overflow:scroll;background:#fefefe;list-style:none;margin-top:3px;padding:5px;}
		.menuitem {float:left;BORDER-BOTTOM: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid; POSITION: absolute; VISIBILITY: hidden;width:70%;}
		.menuitem1 {float:left;BORDER-BOTTOM: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid; POSITION: static; VISIBILITY: visible;width:100%;}
	</style>
	<script type="text/javascript">
	/*
	window.onload = function(){
	//function openDialog(){
	   var userdialog = J('#btn1').dialog({id:'userlist', title:'管理员列表', width:800, height:520, cover:true, page:'<%=path%>/oa/mail/mail_userList.action' });
	   var corpdialog = J('#btn2').dialog({id:'corplist', title:'企业列表', width:900, height:520, cover:true, page:'<%=path%>/oa/notice/notice_corpList.action' });
	
	} 
	*/
	
	$(document).ready(function(){
		$("#btn1").click(function() {
			infoDialog('接收人列表-管理员','900px','358px', '<%=basePath%>/oa/call_userList.action');
		});
		$("#btn2").click(function() {
			infoDialog('接收人列表-企业','900px','358px', '<%=basePath%>/oa/call_corpList.action');
		});
		$("#back").click(function () {
			window.location.href='<%=basePath %>/oa/call/call_perCallList.action?keyWord=${keyWord}&beginTime=${beginTime }&endTime=${endTime }&num=${num }&size=${size }&forward=${forward }&isSends=${isSends }';
		});
	});
	
	
	function deleteChooseUser(id){
		var userIds = $("#adduse").val();
		$("#"+id).remove();
		
		var selectedIds = "";
		var ids = userIds.split(",");
		for(i=0;i<ids.length;i++){
	   		if(ids[i] != id){
				selectedIds += ids[i] + ",";
	   		}
		}
		selectedIds = selectedIds.substring(0, selectedIds.length-1);
		$("#adduse").val(selectedIds);
	}
	function deleteChooseCorp(id){//删除企业
		var userIds = $("#addcorp").val();
		$("#c"+id).remove();
		
		var selectedIds = "";
		var ids = userIds.split(",");
		for(i=0;i<ids.length;i++){
	   		if(ids[i] != id){
				selectedIds += ids[i] + ",";
	   		}
		}
		selectedIds = selectedIds.substring(0, selectedIds.length-1);
		$("#addcorp").val(selectedIds);
	}
	
	
	function deleCorps(id){//删除符合条件的企业
		var selectIds = document.getElementById('addselect');
		selectIds.value="";
		document.getElementById(id).style.display="none";
	}
	function toSend(){
		if(document.mailForm.addUser.value=="" && document.mailForm.addCorp.value=="" && document.mailForm.corpSelect.value==""){
			alert('请选择被提醒人！');
			return false;
		}
		if(document.getElementById('noteCon').value==""){
			alert('提醒内容必填！');
			return false;
		}
		if(document.getElementById('noteCon').value.length>100){
			alert('提醒内容不能大于100字');
			return false;
		}
		//document.mailForm.submit();
		return true;
	}
	</script>
  </head>
  
  <body>
        <div class="body-box">
        <div class="map">
			<div class="map_con">
				您当前的位置：系统提醒 &gt; 个人提醒管理 &gt; 修改个人提醒 
			</div>
		</div>
		<div id="container">
		    <form name="mailForm" action="<%=basePath%>/oa/call_perCallSaveOrUpdate.action" method="post" enctype="multipart/form-data">	    	
		    	<table border="0" cellspacing="0" cellpadding="0"  width="100%" class="info_table">
					<tr>
						<td colspan="2" class="title_li">修改提醒</td>
					</tr>
					<tr>
						<td width="100" class="title_td">提醒时间：</td>
						<td>
							<input type="text" id="bit1" name="callTime" size="120" readonly="readonly" value="<s:date name="perCall.callTime" format="yyyy-MM-dd HH:mm"/>" onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm'})" class="Wdate" style="width:300px"/>							
							<span class="note4">*</span>				
						</td>
					</tr>
					<tr>
						<td width="100" class="title_td">被提醒人：</td>
						<td style="padding-bottom:3px;">
						<li>
							<input type="button" name="bt1" value="选择管理员" id="btn1" class="link_input"/>&nbsp;&nbsp;&nbsp;
							<input type="button" name="bt2" value="选择企业" id="btn2" class="link_input"/>	
						</li>
						<div style="padding-left: 5px">
							<span class="rname">
								<span id="corp1span"></span>
								<span id="addresseeNames">
									<s:iterator id="user" value="userNamesList">
										<span id="${user.id}"><font color="red">${user.userRealName }</font><img src="<%=basePath%>/images/delete.gif" onclick="deleteChooseUser('${user.id }');"/>; </span>
									</s:iterator>
								</span>
								<span id="corpspan">
									<s:iterator id="corp" value="corpNamesList">
										<span id="c${corp.id}">${corp.corpName }<img src="<%=basePath%>/images/delete.gif" onclick="deleteChooseCorp('${corp.id }');"/>; </span>
									</s:iterator>
								</span>
							</span>
						</div>						
						</td>
					</tr>
					<tr>
						<td class="title_td">提醒机制：</td>
						<td > 
							<div style="padding-left: 5px">
								<s:select list="#{0:'消息',1:'手机短信',2:'消息+手机短信'}" listKey="key" listValue="value" theme="simple" id="callSelect" name="callType" value="%{perCall.callType}"></s:select>
								<div id="span1" class="menuitem">短信启动时间（提醒发送一定时间后）：<input type="text" name="noteDay" value="${perCall.noteDay }" size="1" id="bnumber1"/><span class="note4"></span>天 <input type="text" name="noteHour" value="${perCall.noteHour }" size="1"  id="bnumber1"/><span class="note4"></span>小时<input type="text" name="noteSec" value="${perCall.noteSec }" size="1" id="bnumber1"/><span class="note4"></span>分钟
								<br/>提醒次数：<input type="text" name="callNums" value="${perCall.callNums }" size="1"  id="bnumber1"/><span class="note4"></span>&nbsp;&nbsp;&nbsp;提醒间隔时间<input type="text" name="callAtTime" value="${perCall.callAtTime }" size="1" id="bnumber1"/><span class="note4"></span>分钟
								<br/>企业接收人：<s:radio list="#{0:'负责人',1:'安全负责人'}"   listKey="key" listValue="value" theme="simple" name="isCorper" value="%{perCall.isCorper}"></s:radio>
								</div>	
							</div>
						</td>
					</tr>				
					<tr>	
						<td class="title_td">内容：</td>
						<td >
							<div style="padding-left: 5px">
								<textarea rows="5" cols="70%" name="callContent" id="noteCon">${perCall.callContent }</textarea><label id="wordNum" class="note4">字数不能超过100字</label>
							</div>
						</td>
					</tr>				
				</table>
				<table border="0" cellspacing="0" cellpadding="0"  width="100%" style="float:left; padding-top:15px;padding-bottom:5px;">
					<tr>
						<td align="center">
							<input type="submit" id="btnSubmit1" class="link_input" value="提 交" onclick="return toSend();"/>
							<input type="button" class="link_input" value="返 回" id="back"/>
						</td>
					</tr>
				</table>
				<input type="hidden" name="addUser" value="${perCall.callAddsUser }" id="adduse">
		    	<input type="hidden" name="addCorp" value="${perCall.callAddsCorp }" id="addcorp">
		    	<input type="hidden" name="corpSelect" value="" id="addselect">	
		    	<input type="hidden" name="callId" value="${perCall.id }" />	
		    	<input type="hidden" name="num" value="${num }" />
		    	<input type="hidden" name="size" value="${size }" />
		    	<input type="hidden" name="beginTime" value="${beginTime }" />
		    	<input type="hidden" name="endTime" value="${endTime }" />
		    	<input type="hidden" name="keyWord" value="${keyWord }" />
		    </form>
	 </div>
	 
	  </div>
  </body>
</html>
